//
//  OrderDetailViewController.m
//  MyNewProject
//
//  Created by sun on 2019/1/29.
//  Copyright © 2019 sun. All rights reserved.
//
#define kTabDefautHeight 47.0
#import "OrderDetailViewController.h"
#import "OrderCell.h"
#import "HandInPaymentVC.h"
#import "OrderDataModels.h"
#import "CountDown.h"
#import "ProductDetailViewController.h"
#import "ProductDetailVC.h"
#import "AuctionProductDetailVC.h"
#import <WebKit/WebKit.h>

#import "WJBaseModel.h"

@interface WJSheetView : UIView
@property (nonatomic, copy) void(^didSelectedBlock)(NSString *result);
@end

@interface OrderDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView * myTalbleView;
@property(nonatomic,strong)UIView * notDataView;
@property(nonatomic,assign)int page;
@property(nonatomic,retain)NSMutableArray *dataArry;

@property(strong, nonatomic)  CountDown *countDown;
@property(nonatomic,assign)int isFirst;

@end

@implementation OrderDetailViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = SKRGBColor(237, 237, 237);
    self.gk_navigationBar.hidden = YES;
    self.dataArry = [[NSMutableArray alloc] initWithCapacity:0];
    self.page = 1;
    [self.view addSubview:self.myTalbleView];
    self.notDataView.frame = CGRectMake(0,0 ,SCREEN_WIDTH , SCREENH_HEIGHT-SKTopBar_Height-kTabDefautHeight);
}
- (void)setHeaderTabHeight:(CGFloat)headerTabHeight {
    _headerTabHeight = headerTabHeight;
    self.myTalbleView.frame = CGRectMake(0,0 ,SCREEN_WIDTH , SCREENH_HEIGHT-SKTopBar_Height- SKBottomSafe_Height - kTabDefautHeight - headerTabHeight);
}
-(CountDown *)countDown
{
    if (_countDown == nil) {
        _countDown = [[CountDown alloc] init];
        SKWeakSelf;
        ///每秒回调一次
        [_countDown countDownWithPER_SECBlock:^{
            NSLog(@"6");
            [weakSelf updateTimeInVisibleCells];
        }];
    }
    return _countDown;
}
- (UIView *)notDataView {
    if (!_notDataView) {
        self.notDataView = [[UIView alloc] init];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"orderMissing"]];
        imageView.frame = CGRectMake((SCREEN_WIDTH - 93)/2,SKTopBar_Height + 71,93,85.5);
        [_notDataView addSubview:imageView];
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0,imageView.bottom + 18,SCREEN_WIDTH,20);
        label.numberOfLines = 0;
        label.textAlignment = NSTextAlignmentCenter;
        label.font = SKFONT_Semibold(18);
        label.textColor = SKColorWithHex(0x888888);
        label.text = @"暂无数据";
        [_notDataView addSubview:label];
        
        NSString * totalAmtStr = @"快去竞拍吧";
        if (self.type == BuyTypeShop) {
            totalAmtStr = @"快去购买吧";
        }else if (self.type == BuyTypeAuction) {
            totalAmtStr = @"快去竞拍吧";
        }else {}
        UIFont * font = SKFONT_BOLD_SIZE(18);
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake((SCREEN_WIDTH -167)/2, label.bottom + 48, 167 , 41);
        button.imageView.contentMode = UIViewContentModeScaleAspectFit;
        button.backgroundColor = SKColorWithHex(0xE33030);
        [button setTitle:totalAmtStr forState:UIControlStateNormal];
        button.titleLabel.font = font ;
        [button setTitleColor:SKColorWithHex(0xFFFFFF) forState:UIControlStateNormal];
        [button addTarget:self action:@selector(goJingPai:) forControlEvents:UIControlEventTouchUpInside];
        [_notDataView addSubview:button];
        [self.view addSubview:_notDataView];
    }
    return _notDataView;
}
-(void)updateTimeInVisibleCells{
    [self.dataArry enumerateObjectsUsingBlock:^(OrderData * myData, NSUInteger idx, BOOL *  stop) {
        if ([myData.lostEndTime intValue] > 0) {
            myData.lostEndTime = [NSString stringWithFormat:@"%d",[myData.lostEndTime intValue]-1];
        }
    }];
    NSArray  *cells = self.myTalbleView.visibleCells; //取出屏幕可见ceLl
    for (OrderCell *cell in cells) {
        if ([cell.cellModel.status integerValue] == OrderStatusReadyPay) {
            OrderData * myData = self.dataArry[cell.tag];
            cell.timeLab.text = [self getNowTimeWithString:myData.lostEndTime];
        }
    }
}
-(NSString *)getNowTimeWithString:(NSString *)aTimeString{
    NSTimeInterval timeInterval =[aTimeString intValue];
    int hours = (int)(timeInterval/3600);
    int minutes = (int)(timeInterval-hours*3600)/60;
    int seconds = timeInterval-hours*3600-minutes*60;
    NSString *hoursStr;NSString *minutesStr;NSString *secondsStr;
    //小时
    hoursStr = [NSString stringWithFormat:@"%d",hours];
    //分钟
    if(minutes<10)
        minutesStr = [NSString stringWithFormat:@"0%d",minutes];
    else
        minutesStr = [NSString stringWithFormat:@"%d",minutes];
    //秒
    if(seconds < 10)
        secondsStr = [NSString stringWithFormat:@"0%d", seconds];
    else
        secondsStr = [NSString stringWithFormat:@"%d",seconds];
    if (hours<=0&&minutes<=0&&seconds<=0) {
        return [NSString stringWithFormat:@"尾款补交:00:00:00"];
    }
   
    return [NSString stringWithFormat:@"尾款补交:%@:%@:%@",hoursStr , minutesStr,secondsStr];
}
-(UITableView*)myTalbleView
{
    if (_myTalbleView ==nil) {
        _myTalbleView =[[UITableView alloc] initWithFrame:CGRectMake(0,0 ,SCREEN_WIDTH , SCREENH_HEIGHT-SKTopBar_Height-kTabDefautHeight) style:UITableViewStyleGrouped];
        _myTalbleView.dataSource = self;
        _myTalbleView.backgroundColor = SKRGBColor(237, 237, 237);
        _myTalbleView.delegate = self;
        _myTalbleView.estimatedRowHeight = 0;
        _myTalbleView.estimatedSectionFooterHeight = 0;
        _myTalbleView.estimatedSectionHeaderHeight = 0;
        _myTalbleView.separatorStyle = UITableViewCellSeparatorStyleNone;
        if (@available(iOS 11.0, *)) {
            _myTalbleView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        } else {
            self.automaticallyAdjustsScrollViewInsets = NO;
        }
        SKWeakSelf;
        _myTalbleView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
            weakSelf.page = 1;
            if (weakSelf.dataArry.count>0) {
                [weakSelf.myTalbleView.mj_footer resetNoMoreData];
            }
            [weakSelf getData];
        }];
        
        _myTalbleView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
            weakSelf.page += 1;
            [weakSelf getData];
        }];
        _myTalbleView.mj_footer.automaticallyHidden = YES;
    }
    return _myTalbleView;
}
- (NSMutableArray *)dataArry {
    self.notDataView.hidden = _dataArry.count > 0;
    return _dataArry;
}
#pragma mark -  UITableView 代理相关

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArry.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    OrderCell * cell = [tableView dequeueReusableCellWithIdentifier:@"OrderCell"];
    if (!cell) {
        cell = [[OrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"OrderCell"];
    }
    OrderData *orderModel = self.dataArry[indexPath.row];
    if (orderModel) {
        cell.cellModel = orderModel;
    }
    SKWeakSelf;
    cell.myBlock = ^(OrderData *  model, NSInteger tag) {
         //    TODO: 1 尾款补交  2 复制单号  3 联系客服
        switch (tag) {
            case 1:
            {
                HandInPaymentVC  *handInPaymentVC  = [HandInPaymentVC new];
                handInPaymentVC.idStr = model.dataIdentifier;
                if ([model.type isEqualToString:@"1"]) {
                    handInPaymentVC.type = PayTypeAuction;
                }else if ([model.type isEqualToString:@"2"]) {
                    handInPaymentVC.type = PayTypeProduct;
                }else if ([model.type isEqualToString:@"3"]) {
                    handInPaymentVC.type = PayTypeScore;
                }
                [weakSelf.navigationController pushViewController:handInPaymentVC animated:YES];
            }
                break;
            case 2:
            {
                UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
                pasteboard.string = SafeString(model.num);
            }
                break;
            case 3:
            {
                WKWebView*callWebview =[[WKWebView alloc] init];
                NSURL *telURL =[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",model.num]];// 貌似tel:// 或者 tel: 都行
                [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
                //记得添加到view上
                [weakSelf.view addSubview:callWebview];
            }
                break;

            default:
                break;
        }
    };
    [cell setApplyRejectPayBlock:^{
        // 申请退款
        [weakSelf applyRejectPay:orderModel.dataIdentifier];
    }];
    if (self.status == OrderStatusReadyPay || ([orderModel.status integerValue] == 1)) {
        [self countDown];
        cell.timeLab.text = [self getNowTimeWithString:orderModel.lostEndTime];
    }
    cell.tag = indexPath.row;
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80 +30 +10;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 10;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    OrderData *model = self.dataArry[indexPath.row];
    // 1 拍卖 2 商城购买 3 积分兑换
    if ([model.type isEqualToString:@"1"]) {
        // 拍卖详情
        AuctionProductDetailVC *vc = [[AuctionProductDetailVC alloc] init];
        vc.sellId = model.typeId;
        vc.showType = AuctionProductDetailTypeDetail;
        [self.navigationController pushViewController:vc animated:true];
    }else {
        // 商品详情 积分兑换详情
        ProductDetailVC *vc = [[ProductDetailVC alloc] init];
        vc.type = [model.type intValue] - 2; // 2 余额购买 3 积分兑换
        vc.ptId = model.typeId;
        vc.showType = ProductDetailTypeLog;
        [self.navigationController pushViewController:vc animated:true];
    }
}
-(void)goJingPai:(UIButton*)sender
{
    [self.navigationController popToRootViewControllerAnimated:false];
    if (self.type == BuyTypeShop) {
        // 商城
        self.tabBarController.selectedIndex = 0;
    }else if (self.type == BuyTypeAuction) {
        // 拍卖
        self.tabBarController.selectedIndex = 1;
    }else {
        // 其他
        self.tabBarController.selectedIndex = 0;
    }
}

-(void)getData
{
    if (self.status == OrderStatusApplyRepay || self.status == OrderStatusRepayedPass || self.status == OrderStatusRepayedReject) {
        [self getApplyRepayData];
    }else {
        [self getDataWith:self.status BuyType:self.type];
    }
}
- (void)getApplyRepayData {
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    if (self.type > 0) {
        [param addEntriesFromDictionary:@{@"type":@(self.type)}];
    }
    [param addEntriesFromDictionary:@{@"loginKey":self.loginKey, @"uid":self.uid, @"page":@(self.page), @"status":@(99)}];
    SKWeakSelf;
    [YQNetworking postWithUrl:@"My/getOrderList" params:param reloginRefreshBlock:^(id response) {
        
    } successBlock:^(id response) {
        [weakSelf.myTalbleView.mj_header endRefreshing];
        [weakSelf.myTalbleView.mj_footer endRefreshing];
        OrderBaseClass * baseClass = [OrderBaseClass modelObjectWithDictionary:response];
        if ([baseClass.status isEqualToString:@"ok"]||[baseClass.status isEqualToString:@"empty"]) {
            if (weakSelf.page == 1) {
                [weakSelf.dataArry removeAllObjects];
            }
            if (baseClass.data.count > 0) {
                for (OrderData *data in baseClass.data) {
                    [weakSelf.dataArry addObject:data];
                }
            }else {
                if (weakSelf.page == 1) {
                    
                }else {
                    [weakSelf.view makeToast:@"没有更多数据" duration:1 position: CSToastPositionCenter];
                    [weakSelf.myTalbleView.mj_footer endRefreshingWithNoMoreData];
                }
            }
            [weakSelf.myTalbleView reloadData];
        }
        else
        {
            [weakSelf.myTalbleView reloadData];
            if ([[UserInfoSingleton shareInstance].userInfo isLogin]) {
                [weakSelf.view makeToast:SafeString(baseClass.msg) duration:1 position: CSToastPositionCenter];
            }
        }
    } failBlock:^(NSError *error) {
        [weakSelf.myTalbleView.mj_header endRefreshing];
        [weakSelf.myTalbleView.mj_footer endRefreshing];
    }];
}
- (void)getDataWith:(OrderStatus)status BuyType:(BuyType)type {
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    if (self.type > 0) {
        [param addEntriesFromDictionary:@{@"type":@(type)}];
    }
    if (self.status > 0) {
        [param addEntriesFromDictionary:@{@"status":@(status)}];
    }
    [param addEntriesFromDictionary:@{@"loginKey":self.loginKey, @"uid":self.uid, @"page":@(self.page)}];
    SKWeakSelf;
    [YQNetworking postWithUrl:@"My/getOrderList" params:param reloginRefreshBlock:^(id response) {
        
    } successBlock:^(id response) {
        [weakSelf.myTalbleView.mj_header endRefreshing];
        [weakSelf.myTalbleView.mj_footer endRefreshing];
        OrderBaseClass * baseClass = [OrderBaseClass modelObjectWithDictionary:response];
        if ([baseClass.status isEqualToString:@"ok"]||[baseClass.status isEqualToString:@"empty"]) {
            if (weakSelf.page == 1) {
                [weakSelf.dataArry removeAllObjects];
            }
            if (baseClass.data.count > 0) {
                if (weakSelf.page > 1) {
                    [weakSelf.dataArry addObjectsFromArray:baseClass.data];
                }else {
                    for (OrderData *data in baseClass.data) {
                        [weakSelf.dataArry addObject:data];
                    }
                }
            }else {
                if (weakSelf.page == 1) {
                    
                }else {
                    [weakSelf.view makeToast:@"没有更多数据" duration:1 position: CSToastPositionCenter];
                    [weakSelf.myTalbleView.mj_footer endRefreshingWithNoMoreData];
                }
            }
            [weakSelf.myTalbleView reloadData];
        }
        else
        {
            [weakSelf.myTalbleView reloadData];
            if ([[UserInfoSingleton shareInstance].userInfo isLogin]) {
                [weakSelf.view makeToast:SafeString(baseClass.msg) duration:1 position: CSToastPositionCenter];
            }
        }
    } failBlock:^(NSError *error) {
        [weakSelf.myTalbleView.mj_header endRefreshing];
        [weakSelf.myTalbleView.mj_footer endRefreshing];
    }];
}
/// 申请退款
/// @param orderId orderId
- (void)applyRejectPay:(NSString *)orderId {
    WJSheetView *sheetView = [[WJSheetView alloc] initWithFrame:CGRectZero];
    SKWeakSelf;
    __weak typeof(sheetView) weakSheetView = sheetView;
    [sheetView setDidSelectedBlock:^(NSString *result) {
        __strong typeof(weakSheetView) strongSheetView = weakSheetView;
        [strongSheetView removeFromSuperview];
        NSDictionary *param = @{@"uid":weakSelf.uid,
                                @"loginKey":weakSelf.loginKey,
                                @"order_id":orderId,
                                @"msg":result};
        [YQNetworking getWithUrl:@"my/setOrderRefund" params:param reloginRefreshBlock:^(id response) {
            
        } successBlock:^(id response) {
            WJBaseModel *model = [WJBaseModel modelWithDictionary:response];
            if ([model isSuccess]) {
                // 申请成功
                [weakSelf getData];
            }else {
                // 申请失败
                
            }
            [weakSelf showMessage:model.msg];
        } failBlock:^(NSError *error) {
            [weakSelf debugShowMessage:error.localizedDescription];
        }];
    }];
    [[UIApplication sharedApplication].keyWindow addSubview:sheetView];
    [sheetView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.top.mas_offset(0);
    }];
}
-(void)dealloc
{
    if (_countDown) {
        [_countDown destoryTimer];
        SKLog(@"释放了");
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


@interface WJSheetViewCell : UITableViewCell

@end

@interface WJSheetViewCell()
@property (nonatomic, strong) UIImageView *selectImageView;
@end

@implementation WJSheetViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupContentView];
    }
    return self;
}

- (void)setupContentView {
    [self.selectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_offset(0);
        make.width.mas_equalTo(self.selectImageView.mas_height);
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    self.selectImageView.hidden = !selected;
}

#pragma mark -- mark 懒加载
- (UIImageView *)selectImageView {
    if (!_selectImageView) {
        _selectImageView = [[UIImageView alloc] initWithImage:SKIMAGE_NAMED(@"mine_pay_choose_select_btn_img")];
        _selectImageView.contentMode = UIViewContentModeCenter;
        [self addSubview:_selectImageView];
    }
    return _selectImageView;
}
@end

@interface WJSheetView() <UITableViewDelegate, UITableViewDataSource>{}
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray<NSString *> *dataArray;
@property (nonatomic, copy) NSString *resultString;
@end
@implementation WJSheetView
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];
        [self initContentView];
    }
    return self;
}

#pragma mark -- mark 懒加载
- (UITableView *)tableView {
    if (!_tableView) {
        self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.showsVerticalScrollIndicator = false;
        _tableView.showsHorizontalScrollIndicator = false;
        [_tableView registerClass:[WJSheetViewCell class] forCellReuseIdentifier:@"id"];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableHeaderView = [UIView new];
        _tableView.tableFooterView = [UIView new];
        _tableView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_tableView];
    }
    return _tableView;
}
- (NSArray<NSString *> *)dataArray {
    if (!_dataArray) {
        _dataArray = @[@"协商一致退款",
                       @"未按约定发货",
                       @"缺货",
                       @"排错/多拍/不想要",
                       @"其他"];
    }
    return _dataArray;
}
- (void)initContentView {
    
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = [UIColor whiteColor];
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = SKRGBAColor(0, 0, 0, 0.4);
    [self addSubview:headerView];
    [self addSubview:line];
    
    UIButton *cancel = [UIButton buttonWithType:UIButtonTypeCustom];
    [cancel setTitle:@"取消" forState:UIControlStateNormal];
    cancel.titleLabel.font = SKFONT_SIZE(13);
    [cancel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [cancel addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [headerView addSubview:cancel];
    
    UIButton *sure = [UIButton buttonWithType:UIButtonTypeCustom];
    [sure setTitle:@"提交" forState:UIControlStateNormal];
    sure.titleLabel.font = SKFONT_SIZE(13);
    [sure setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [sure addTarget:self action:@selector(sureButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [headerView addSubview:sure];
    
    [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_offset(0);
        make.height.mas_equalTo(45);
        make.bottom.mas_equalTo(line.mas_top);
    }];
    
    [cancel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_offset(0);
        make.left.mas_offset(15);
    }];
    
    [sure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_offset(0);
        make.right.mas_offset(-15);
    }];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_offset(0);
        make.height.mas_equalTo(0.48);
        make.bottom.mas_equalTo(self.tableView.mas_top);
    }];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_offset(0);
        make.height.mas_equalTo(200);
    }];
}

#pragma mark -- mark UITableViewDelegate UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    WJSheetViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id" forIndexPath:indexPath];
    cell.textLabel.font = SKFONT_Medium(13);
    cell.textLabel.textColor = [UIColor blackColor];
    cell.textLabel.text = self.dataArray[indexPath.row];
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 40;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.resultString = self.dataArray[indexPath.row];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self removeFromSuperview];
}

#pragma mark -- mark EVENT
- (void)cancelButtonClick:(UIButton *)sender {
    [self removeFromSuperview];
}
- (void)sureButtonClick:(UIButton *)sender {
    if (self.didSelectedBlock && self.resultString.length > 0) {
        self.didSelectedBlock(self.resultString);
    }
}
@end
/*
NSString *s1 = @"协商一致退款";
NSString *s2 = @"未按约定发货";
NSString *s3 = @"缺货";
NSString *s4 = @"排错/多拍/不想要";
NSString *s5 = @"其他";
*/

